Add dom0 op to pin a domain to a specified CPU (or -1 to unpin).
This function is currently only supported for domains that have
been 'created' but not 'built' or 'started'.
3fbe2f12OPAkzIUtumU3wRAihnhocQ tools/examples/createlinuxdom.py
3fbe2f12dZbmXLlgQdMgkmnSUj23AQ tools/examples/destroydom.py
3fbe2f12ltvweb13kBSsxqzZDAq4sg tools/examples/listdoms.py
+3fca7700PVj36cZObaFZlQicRiw1pQ tools/examples/pincpu.py
3fbe2f12Bnt8mwmr1ZCP6HWGS6yvYw tools/examples/stopdom.py
3f776bd2Xd-dUcPKlPN2vG89VGtfvQ tools/misc/Makefile
3f6dc136ZKOjd8PIqLbFBl_v-rnkGg tools/misc/miniterm/Makefile
xen/drivers/scsi/aic7xxx/aic79xx_osm_pci.o
xen/drivers/scsi/aic7xxx/aic79xx_pci.o
xen/drivers/scsi/aic7xxx/aic79xx_proc.o
+tools/xc/lib/xc_bvtsched.o
+tools/xc/lib/xc_domain.o
+tools/xc/lib/xc_linux_build.o
+tools/xc/lib/xc_linux_restore.o
+tools/xc/lib/xc_linux_save.o
+tools/xc/lib/xc_misc.o
+tools/xc/lib/xc_private.o
+tools/xc/lib/xc_vbd.o
+tools/xc/lib/xc_vif.o
+xen/xen.s
--- /dev/null
+#!/usr/bin/env python
+
+#
+# Destroy specified domain.
+#
+
+import Xc, sys, re
+
+xc = Xc.new()
+
+if len(sys.argv) < 3:
+ print "Specify a domain identifier and CPU"
+ sys.exit()
+
+xc.domain_pincpu( dom=int(sys.argv[1]), cpu=int(sys.argv[2]))
+
return do_dom0_op(xc_handle, &op);
}
+int xc_domain_pincpu(int xc_handle,
+ unsigned int domid,
+ int cpu)
+{
+ dom0_op_t op;
+ op.cmd = DOM0_PINCPUDOMAIN;
+ op.u.pincpudomain.domain = domid;
+ op.u.pincpudomain.cpu = cpu;
+ return do_dom0_op(xc_handle, &op);
+}
+
+
int xc_domain_getinfo(int xc_handle,
unsigned int first_domid,
unsigned int max_doms,
return PyInt_FromLong(ret);
}
+static PyObject *pyxc_domain_pincpu(PyObject *self,
+ PyObject *args,
+ PyObject *kwds)
+{
+ XcObject *xc = (XcObject *)self;
+
+ unsigned int dom;
+ int cpu, ret;
+
+ static char *kwd_list[] = { "dom", "cpu", NULL };
+
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
+ &dom, &cpu) )
+ return NULL;
+
+ ret = xc_domain_pincpu(xc->xc_handle, dom, cpu);
+
+ return PyInt_FromLong(ret);
+}
+
static PyObject *pyxc_domain_getinfo(PyObject *self,
PyObject *args,
PyObject *kwds)
" force [int, 0]: Bool - force immediate destruction?\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
+ { "domain_pincpu",
+ (PyCFunction)pyxc_domain_pincpu,
+ METH_VARARGS | METH_KEYWORDS, "\n"
+ "Pin a domain to a specified CPU.\n"
+ " dom [int]: Identifier of domain to be destroyed.\n"
+ " force [int, -1]: CPU to pin to, or -1 to unpin\n\n"
+ "Returns: [int] 0 on success; -1 on error.\n" },
+
{ "domain_getinfo",
(PyCFunction)pyxc_domain_getinfo,
METH_VARARGS | METH_KEYWORDS, "\n"
' proto=any\n' )
os.close( fd )
return None
+
+def addr_of_iface( iface ):
+ fd = os.popen( '/sbin/ifconfig '+iface )
+ lines = fd.readlines()
+ for line in lines:
+ m = re.search( 'inet addr:([0-9.]+)', line )
+ if m:
+ return m.group(1)
+ return None
+
+def add_to_ip( ip, off ):
+ l = string.split(ip,'.')
+ return '%s.%s.%s.%d' % ( l[0],l[1],l[2],string.atoi(l[3])+off )
+
}
break;
+ case DOM0_PINCPUDOMAIN:
+ {
+ struct task_struct * p = find_domain_by_id(op.u.pincpudomain.domain);
+ int cpu = op.u.pincpudomain.cpu;
+ ret = -EINVAL;
+ if ( p != NULL )
+ {
+ if( cpu == -1 )
+ p->cpupinned = 0;
+ else
+ {
+ /* For the moment, we are unable to move running
+ domains between CPUs. (We need a way of cleanly stopping
+ running domains). For now, if we discover the domain is
+ running then cowardly bail out with ENOSYS */
+
+ if(p->flags & PF_CONSTRUCTED)
+ ret = -ENOSYS;
+ else
+ {
+ cpu = cpu % smp_num_cpus;
+ p->processor = cpu;
+ p->cpupinned = 1;
+ }
+ }
+
+ ret = 0;
+ put_task_struct(p);
+ }
+
+ }
+ break;
+
case DOM0_BVTCTL:
{
unsigned long ctx_allow = op.u.bvtctl.ctx_allow;
unsigned int cmd;
} dom0_readconsole_t;
+/*
+ * Pin Domain to a particular CPU (use -1 to unpin)
+ */
+#define DOM0_PINCPUDOMAIN 20
+typedef struct dom0_pincpudomain_st
+{
+ /* IN variables. */
+ unsigned int domain;
+ int cpu; /* -1 implies unpin */
+} dom0_pincpudomain_t;
+
typedef struct dom0_op_st
{
unsigned long cmd;
dom0_debug_t debug;
dom0_settime_t settime;
dom0_readconsole_t readconsole;
+ dom0_pincpudomain_t pincpudomain;
} u;
} dom0_op_t;
+
+
+
+
#endif
struct list_head run_list;
int has_cpu;
int state; /* current run state */
-
+ int cpupinned; /* true if pinned to curent CPU */
+
s_time_t lastschd; /* time this domain was last scheduled */
s_time_t cpu_time; /* total CPU time received till now */
s_time_t wokenup; /* time domain got woken up */